//
//  UIView + Extension.swift
//  loveBee
//
//  Created by zhangxing on 2017/8/13.
//  Copyright © 2017年 zhangXing. All rights reserved.
//

import UIKit

extension UIView {
    
    //坐标x
    
    var x: CGFloat? {
        
        get {
            return frame.origin.x
        }
        set {
            
            frame.origin.x = newValue!
            
        }
    }
    
    //坐标y
    var y: CGFloat? {
        
        get {
            return frame.origin.y
            
        }
        set {
            
            frame.origin.y = newValue!
        }
    }
    
    //width
    var width: CGFloat? {
        
        get {
            return frame.size.width
            
        }
        set {
            
            frame.size.width = newValue!
        }
    }
    
    //height
    var height: CGFloat? {
        
        get {
            
            return frame.size.height
        }
        set {
            
            frame.size.height = newValue!
        }
    }
    
    //中心x
    var centerX: CGFloat? {
        
        get {
            return center.x
            
        }
        set {
            center.x = newValue!
            
        }
    }
    
    //中心点y
    var centerY: CGFloat? {
        
        get {
            
            return center.y
        }
        set {
            
            center.y = newValue!
        }
    }
    
    //size
    var size: CGSize? {
        
        
        get {
            
            return frame.size
        }
        set {
            
            frame.size = newValue!
        }
    }
    
    
    
}
